using System;
using System.Collections.Generic;
using System.Text;

using NUnit.Framework;
using DataAccessLayer;

namespace Relationships
{
    [TestFixture]
    public class ReviewRecordingFixture : RecordingBaseFixture
    {
        private ReviewGateway reviewGateway;
        private long reviewId;

        [SetUp]
        public new void SetUp()
        {
            base.SetUp();
            reviewGateway = new ReviewGateway(Connection);
            reviewId = reviewGateway.Insert(1, "Test Review", RecDataSet);

            RecordingDataSet.ReviewRow row = reviewGateway.FindById(reviewId, RecDataSet);
            row.RecordingRow = Recording;

            reviewGateway.Update(RecDataSet);

           
            
        }

        [TearDown]
        public new void TearDown()
        {
            reviewGateway.Delete(reviewId, RecDataSet);
            base.TearDown();
        }

        [Test]
        public void Count()
        {
             Assert.AreEqual(1, Recording.GetReviewRows().Length);
        }

        [Test]
        public void ParentId()
        {
            foreach (RecordingDataSet.ReviewRow review in Recording.GetReviewRows()) {
                  Assert.AreEqual(Recording.id, review.recordingid);            
            }

        }
    }
}
